/**
 * 
 */

package view.jstl;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;

/**
 * @author Eric.Kao(gau168.gau@msa.hinet.net)
 * @version 1.0
 * @company E885 Group
 * @copyright Copyright (c) 2001-2008
 */

public class JSTLController implements Controller
{
	private String viewPage;

	/*
	 * (non-Javadoc)
	 * 
	 * @see org.springframework.web.servlet.mvc.Controller#handleRequest(javax.servlet.http.HttpServletRequest,
	 *      javax.servlet.http.HttpServletResponse)
	 */
	public ModelAndView handleRequest( HttpServletRequest request, HttpServletResponse response ) throws Exception
	{
		String user = request.getParameter( "name" );
		Integer age = new Integer( Integer.parseInt( request.getParameter( "age" ) ) );

		java.util.Map< String, Object > model = new java.util.HashMap< String, Object >();
		model.put( "name", user );
		model.put( "age", age );

		return new ModelAndView( viewPage, model );
	}

	/**
	 * @return the viewPage
	 */
	public String getViewPage()
	{
		return viewPage;
	}

	/**
	 * @param viewPage the viewPage to set
	 */
	public void setViewPage( String viewPage )
	{
		this.viewPage = viewPage;
	}

}
